package com.tj.collection.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fqgj.common.utils.DateUtil;
import com.fqgj.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * 配置类
 * User: pavan
 * Date: 2020/12/29
 * Time: 下午3:47
 */
@Component
public class ConfigUtil {
    public static final Logger LOGGER = LoggerFactory.getLogger(ConfigUtil.class);

    @Autowired
    private DbCachePublicConfig publicConfig; //inject config for namespace application

    @Autowired
    private DbCacheSystemConfig systemPublicConfig; //inject config for namespace application

    @Autowired
    private DbCacheConfig config; //inject config for namespace application

    public String getFqgjCnBucketName() {
        return publicConfig.getProperty("oss.fqgj.cn.bucketName", "");
    }

    public boolean isServerTest() {
        return systemPublicConfig.getBooleanProperty("server.test", false);
    }

    public String getAccessKeyId() {
        return publicConfig.getProperty("oss.accessKeyId", "");
    }

    public String getAccessKeySecret() {
        return publicConfig.getProperty("oss.accessKeySecret", "");
    }

    public String getOssImageUrl() {
        return publicConfig.getProperty("oss.image.url", "");
    }

    public String getInternalUrl(String url) {
        url = url.replace("cashmama-oss-pro.cashmama.in", "cashmama-pro.oss-ap-south-1-internal.aliyuncs.com");
        url = url.replace("cashmama-pro.oss-ap-south-1.aliyuncs.com", "cashmama-pro.oss-ap-south-1-internal.aliyuncs.com");
        return url;
    }



    public String getQsyqBaseUrl() {
        return publicConfig.getProperty("oss.qsyq.base.url", "");
    }

    public String getOssImageBuketName() {
        return publicConfig.getProperty("oss.image.bucketName", "");
    }

    public String getOssFqgjCnBuketName() {
        return publicConfig.getProperty("oss.fqgj.cn.bucketName", "");
    }

    public String getBucketName() {
        return publicConfig.getProperty("oss.bucketName", "");
    }

    public String getQsyqBucketName() {
        return publicConfig.getProperty("oss.qsyq.bucketName", "");
    }

    public String getPageBucketName() {
        return publicConfig.getProperty("oss.page.bucketName", "");
    }

    public String getOssEndPoint() {
        return publicConfig.getProperty("oss.endpoint", "");
    }

    public String getOssPublicEndPoint() {
        return publicConfig.getProperty("oss.public.endpoint", "");
    }

    public String getAmazonS3BaseUrl() {
        return publicConfig.getProperty("amazon.s3.base.url", "");
    }

    public String getStsDomain() {
        return config.getProperty("oss.sts.domain", "");
    }

    public String getPirvateAccessKeyId() {
        return config.getProperty("oss.private.accessKeyId", "");
    }

    public String getPrivateAccessKeySecret() {
        return config.getProperty("oss.private.accessKeySecret", "");
    }

    public String getAccessRoleArn() {
        return config.getProperty("oss.RoleArn", "");
    }

    public String getAppApiWebPath() {
        return config.getProperty("app.api.web.path", "");
    }

    public String getApiWebPath() {
        return config.getProperty("api.web.path", "");
    }

    public String getJobRunIP() {
        return config.getProperty("job.run.ip", "");
    }

    public String getMQTopic() {
        return publicConfig.getProperty("ons.mq.topic", "");
    }

    public String getAuditDistributeSwitch() {
        return config.getProperty("audit.distribute.switch", "false");
    }

    public String getAuditRiskPushSwitch() {
        return config.getProperty("risk.audit.switch", "{}");
    }

    public String getAuditSendMessageSwitch() {
        return config.getProperty("audit.send.message.switch", "false");

    }

    public String getLoginWhiteAccountList() {
        return config.getProperty("login.verifyCode.white.account.list", "");
    }

    public String getNotifyOverDueSwitch() {
        return config.getProperty("notify.overdue.switch", "false");
    }

    public boolean getLoanSwitch() {
        return config.getBooleanProperty("loan.switch", false);
    }

    public String getRedisHost() {
        return publicConfig.getProperty("redis.host", "");
    }

    public int getRedisPort() {
        return publicConfig.getIntProperty("redis.port", 0);
    }

    public String getRedisPassword() {
        return publicConfig.getProperty("redis.password", "");
    }

    public int getRedisMaxActive() {
        return publicConfig.getIntProperty("redis.maxActive", 0);
    }

    public int getRedisMaxIdle() {
        return publicConfig.getIntProperty("redis.maxIdle", 0);
    }

    public String getRiskCallBackWhiteUser() {
        return config.getProperty("risk.callback.white.usercodes", null);
    }

    public String getRiskCallBackWhiteUserResult() {
        return config.getProperty("risk.callback.white.result", null);
    }

    public int getOverdueMin() {
        return config.getIntProperty("overdue.ai.min", 0);
    }

    public int getOverdueMax() {
        return config.getIntProperty("overdue.ai.max", 0);
    }

    public int getOverdueDayNum() {
        return config.getIntProperty("overdue.ai.day.num", 0);
    }

    public String getOverdueCode() {
        return config.getProperty("overdue.ai.code", null);
    }


    /**
     * 获取未逾期用户电话沟通开关
     *
     * @return
     */
    public Boolean getNoOverdueCallBack() {
        return config.getBooleanProperty("no.overdue.callback", false);
    }

    /**
     * 逾期AI电话催收
     *
     * @return
     */
    public Boolean getOverdueCallBack() {
        return config.getBooleanProperty("overdue.ai.callback.switch", false);
    }


    /**
     * 获取用户冻结时间
     */
    public int getUserFreezeDays() {
        return config.getIntProperty("user.freeze.days", 90);
    }

    /**
     * 逾期通知
     */
    public String getMsgPushOverdueReminder() {
        return config.getProperty("msg.push.overdue.reminder", "Overdue Reminder|Your loan of ##AMOUNT##INR was due on ##REPAYMENTDATE##, and now it is ##OVERDUEDAYS## days overdue. Kindly make the payment immediately to avoid late payment fees and to avoid reporting your status to CIBIL as ##OVERDUEDAYS## days past due. |APP/main");
    }

    /**
     * 逾期邮件通知内容
     */
    public String getMsgMailOverdueReminderContent() {
        return config.getProperty("msg.mail.overdue.reminder.content", "Your  __amount__INR payment is overdue for __overdueDay__ days, kindly make the payment immediately to avoid late payment fees and to avoid reporting your status to CIBIL as __overdueDay__ days past due.");
    }

    /**
     * 手动发邮件 邮件内容
     */
    public String getManualEmailContent() {
        return config.getProperty("msg.mail.manual.content", "");
    }


    /**
     * 用户解冻
     */
    public String getMsgPushAccountThaw() {
        return config.getProperty("msg.push.account.thaw", "Account Thaw|Your account has been unfrozen, click borrow immediately, the maximum amount of 5000.00INR is waiting for you!|APP/main");
    }

    public String getMsgPushAccountThawByEmail() {
        return config.getProperty("msg.mail.account.thaw", "Your account has been re-activated, click borrow immediately, the maximum amount of 5000.00INR is waiting for you!");
    }

    /**
     * 用户付款成功
     */
    public String getMsgPushSuccessfulPayment() {
        return config.getProperty("msg.push.successful.payment", "Successful Payment|The loan of ##BORROW##INR you applied has been transferred to your bank card whose last number is ##BANKNO##, and the amount received is ##RECEIVE##INR. Please check.|APP/main");
    }

    /**
     * 审核通过
     */
    public String getMsgPushLoanApproval() {
        return config.getProperty("msg.push.loan.approval", "Loan Approval|Congratulations, your loan application has been approved,will get money soon!|APP/main");
    }

    /**
     * 邮件基础模板地址
     */
    public String getMailBasicTemplateUrl() {
        return config.getProperty("mail.basic.template.url", "https://cashmama-pro.oss-ap-south-1.aliyuncs.com/email/basicTemplate.html");
    }

    /**
     * 邮件基础模板地址--MoneyTube
     */
    public String getMoneyTubeMailBasicTemplateUrl() {
        return config.getProperty("credit.money.tube.mail.basic.template.url", "http://cashmama-oss-pro.cashmama.in/app/cbazar/basicTemplate.htm");
    }

    /**
     * 邮件基础模板地址02
     */
    public String getMailBasicTemplate02Url() {
        return config.getProperty("mail.basic.template.url", "https://cashmama-pro.oss-ap-south-1.aliyuncs.com/email/basicTemplate_2.html");
    }

    /**
     * 邮件基础模板地址02--MoneyTube
     */
    public String getMoneyTubeMailBasicTemplate02Url() {
        return config.getProperty("credit.money.tube.mail.basic.template.url", "http://cashmama-oss-pro.cashmama.in/app/cbazar/basicTemplate_2.html");
    }

    /**
     * 审核通过邮件内容
     */
    public String getMailPushLoanApprovalContent(String appName) {
        String key = String.format("%s.mail.push.loan.approval.content", appName.toLowerCase());
        return config.getProperty(key, "Congratulations, your loan application has been approved,will get money soon!");
    }

    /**
     * 审核拒绝
     */
    public String getMsgPushLoanAuditRejection() {
        return config.getProperty("msg.push.loan.audit.rejection", "Loan Audit Rejection|Your application for loan has been rejected. You can apply again on ##APPLYDATE##.|APP/main");
    }

    /**
     * 审核拒绝
     */
    public String getMailPushLoanAuditRejectionContent() {
        return config.getProperty("mail.push.loan.audit.rejection.content", "Your application for loan has been rejected. You can apply again on __applyDate__. ");
    }

    /**
     * 信息重传
     */
    public String getMsgPushLoanAuditReedit() {
        return config.getProperty("msg.push.loan.audit.reedit", "Re-edit information|Some information  you edit  is invalid. Please click to re-edit for approval.|APP/main");
    }

    /**
     * 信息重传邮件
     */
    public String getMsgEmailLoanAuditReedit() {
        return config.getProperty("msg.email.loan.audit.reedit", "Some information  you edit  is invalid. Please click to re-edit for approval.");
    }

    /**
     * 照片重拍
     */
    public String getMsgPushPhotoRemake() {
        return config.getProperty("msg.push.photo.remake", "Photos to Remake|The photo you uploaded is invalid. Please click to upload again.|APP/##JUMPPAGE##");
    }

    public String getReUploadEmailContent() {
        return config.getProperty("reUploadEmailContent", "");
    }

    /**
     * 放款成功邮件
     */
    public String getPaymentEmailContent() {
        return config.getProperty("msg.mail.payment", "Based on your loan application for Line of Credit facility, __NBFC NAME__, our lending partner, has\n" +
                "                                        provided you with a credit line facility of Rs.__Amount___ on __Date__ based on the Drawdown Request from you.\n" +
                "                                        <br /><br />\n" +
                "                                        Please find a copy of the Application Form, Standard Terms and Most Important Terms and Conditions (MITC) for your\n" +
                "                                        records.");
    }

    /**
     * 解冻成功邮件content
     */
    public String thawUserMailMainContent() {
        return publicConfig.getProperty("msg.mail.thaw.user", "Your account has been re-activated, click borrow immediately, the maximum amount of 5000 INR is waiting for you. ");
    }


    /**
     * 还款短链接邮件内容
     */
    public String getMailRepaymenturlContent() {
        return config.getProperty("mail.repaymenturl.content", "Your loan at __AppName__ is due. To avoid penalties and affect your next loan, you can pay through the following payment link: __Links__");
    }

    /**
     * 需要转人工的userCode列表
     */
    public String getNeedToManpowerUserCodeList() {
        return config.getProperty("manpower.user.code.list", "");
    }

    /**
     * 拒绝三天未审数据
     */
    public String getRefuseAuditOrder() {
        return config.getProperty("reject.audit.order.switch", "false");
    }

    /**
     * 风控地址
     *
     * @return
     */
    public String getRiskHost() {
        return config.getProperty("risk.api.host", "");
    }

    /**
     * admin 自己的域名
     *
     * @return
     */
    public String getAdminUrl() {
        return config.getProperty("admin.rest.url", "");
    }

    /**
     * admin 自己的域名
     *
     * @return
     */
    public boolean getRiskNewReportFlag() {
        return config.getBooleanProperty("risk.new.report", false);
    }

    /**
     * 强制转人工
     *
     * @return
     */
    public Integer getAuditMandatoryResult() {
        return config.getIntProperty("audit.mandatory.result", null);
    }

    /**
     * 风控通过结果转换
     *
     * @return
     */
    public Integer getAuditPassMandatoryResult() {
        return config.getIntProperty("audit.pass.mandatory.result", null);
    }

    /**
     * 推广渠道是否能直接通过
     *
     * @return
     */
    public Boolean getPromotionChannelAutoPass() {
        return config.getBooleanProperty("promotion.auto.pass", false);
    }

    /**
     * 信审每日单数（default值）
     *
     * @return
     */
    public int getAuditOrderDateNum() {
        return Integer.parseInt(config.getProperty("audit.order.date.num", "100"));
    }

    /**
     * 是否需要EQ报告 默认false
     *
     * @return
     */
    public Boolean IsNeedEquifax() {
        return config.getBooleanProperty("audit.need.equifax", false);
    }

    /**
     * 超时中心开关
     *
     * @return
     */
    public String getTimeoutSwitch() {
        return config.getProperty("timeout.switch", "");
    }

    /**
     * 超时中心开关
     *
     * @return
     */
    public Boolean getOperationSwitch() {
        return config.getBooleanProperty("operation.switch", true);
    }

    /**
     * 获取计算total point 的规则
     *
     * @return
     */
    public String getTotalPointRule() {
        return config.getProperty("collection.total.point.rule", "");
    }

    /**
     * excel导出数量限制
     *
     * @return
     */
    public int getExcelExportLineNum() {
        return config.getIntProperty("excel.export.line.num", 5000);
    }


    public Boolean isAllocateSwitchOpen() {
        return config.getBooleanProperty("new.allocate.switch", false);
    }

    public Boolean isStageTransferSwitchOpen() {
        return config.getBooleanProperty("new.stage.transfer.switch", false);
    }

    public Boolean isFixWrongAllocationStrageSwitchOpen() {
        return config.getBooleanProperty("fix.wrong.allocation.storage.switch", false);
    }

    /**
     * 是否开启商户菜单权限同步
     *
     * @return
     */
    public boolean getMerchantMenuSyncSwitch() {
        return config.getBooleanProperty("merchant.menu.sync.switch", false);
    }

    public Boolean allowToPushToRisk() {
        return config.getBooleanProperty("new.allow.push.to.risk", false);
    }


    public String langeuageNeedFixMerchant() {
        return config.getProperty("language.need.fix.merchant", "CASHMAMA");
    }


    public boolean langeuageNeedFixMerchantSwitch() {
        return config.getBooleanProperty("language.need.fix.merchant.switch", false);
    }

    /**
     * 产品类目映射
     */
    public String productCategoryMap(String sourceCategory) {
        String categoryMap = config.getProperty("product.category.map", "[\n" +
                "    {\n" +
                "        \"productCategory\":\"dd\",\n" +
                "        \"mapProductCategory\":\"sdzzall\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"dd\",\n" +
                "        \"mapProductCategory\":\"sdzzall\"\n" +
                "    }\n" +
                "]");


        JSONArray jsonArray = JSONArray.parseArray(categoryMap);
        for (Object o : jsonArray) {
            JSONObject jsonObject = (JSONObject) o;
            String productCategory = jsonObject.getString("productCategory");
            String mapProductCategory = jsonObject.getString("mapProductCategory");
            if (sourceCategory.equals(productCategory)) {
                return mapProductCategory;
            }
        }

        return sourceCategory;
    }


    public String getAppNameByProductCategory(String sourceCategory) {
        String categoryMap = config.getProperty("appName.product.category.map", "[\n" +
                "    {\n" +
                "        \"productCategory\":\"sdzzall\",\n" +
                "        \"appName\":\"cashmama\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"cashbullAll\",\n" +
                "        \"appName\":\"cashmama\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"beautyCashAll\",\n" +
                "        \"appName\":\"cashmama\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"cashboxall\",\n" +
                "        \"appName\":\"cashmama\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"dhanaDhanV6All\",\n" +
                "        \"appName\":\"dhanadhan\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"dhanaDhanV7All\",\n" +
                "        \"appName\":\"dhanadhan\"\n" +
                "    },\n" +
                "       { \"productCategory\":\"loanZoneAll\",\n" +
                "        \"appName\":\"loanZone\"\n" +
                "    }\n" +
                "]");

        JSONArray jsonArray = JSONArray.parseArray(categoryMap);
        for (Object o : jsonArray) {
            JSONObject jsonObject = (JSONObject) o;
            String productCategory = jsonObject.getString("productCategory");
            String appName = jsonObject.getString("appName");
            if (sourceCategory.equals(productCategory)) {
                return appName;
            }
        }

        return sourceCategory;
    }

    /**
     * @return cashmama管理的产品类表
     */
    public List<String> productCategoryManagedByCashmama() {
        String productCategoryManagedByCashmama = config.getProperty("productCategoryManagedByCashmama", "sdzzall,cashbullAll,beautyCashAll");
        return Arrays.asList(productCategoryManagedByCashmama.split(","));
    }

    /**
     * highmark config
     *
     * @return
     */
    public JSONObject getHighmarkConfig() {
        String tmp = config.getProperty("highmark.config", "");
        if (StringUtils.isEmpty(tmp)) {
            return new JSONObject();
        }
        return JSON.parseObject(tmp);
    }

    /**
     * mock highmark body
     *
     * @return
     */
    public String getMockHighmarkBody() {
        return config.getProperty("test.mock.highmark.body", "");
    }

    /**
     * highmark报告返回S09时的处理方式
     *
     * @return
     */
    public boolean getHighmarkS09Result() {
        return config.getBooleanProperty("default.s09.result", false);
    }

    /**
     * 默认返回通过，打开该开关之后才会采用请求的highmark接口
     *
     * @return
     */
    public boolean getHighmarkResultSwitch() {
        return config.getBooleanProperty("is.highmark.result.switch.open", false);
    }

    /**
     * highmark mock通过的usercode
     *
     * @return
     */
    public String getHighmarkMockPassUser() {
        return config.getProperty("highmark.mockpass.usercode", "");
    }

    /**
     * 自动获取highmark任务
     *
     * @return
     */
    public boolean getAuditAutoHighmarkSwitch() {
        return config.getBooleanProperty("audit.auto.highmark.switch", false);
    }

    /**
     * highmark任务 依赖超时中心处理
     *
     * @return
     */
    public boolean getAuditAutoHighmarkByJob() {
        return config.getBooleanProperty("audit.highmark.byjob.switch", false);
    }

    /**
     * 需要走highmark报告的类目
     *
     * @return
     */
    public String hasHighmarkProcess() {
        return config.getProperty("has.highmark.process.categories", "");
    }

    /**
     * 需要走highmark报告的类目
     *
     * @return
     */
    public boolean getHighmarkReportReuseSwitch() {
        return config.getBooleanProperty("highmark.report.reuse.switch", false);
    }

    /**
     * 推送提醒
     *
     * @return
     */
    public boolean userPushRemindSwitch() {
        return config.getBooleanProperty("user.push.remind.switch", false);
    }

    /**
     * 展期提醒
     *
     * @return
     */
    public boolean userExtensionRemindSwitch() {
        return config.getBooleanProperty("user.extension.remind.switch", false);
    }

    /**
     * highmark获取异常的用户 通过阿波罗的配置来进行处理
     * 0-不处理 1-通过 2-拒绝
     * 格式：userCode+日期+处理方式
     * 例子："2020011699009418266310|20200120|PASS,2020011699009418266312|20200120|REJECT"
     *
     * @return
     */
    public int getHighmarkMockResult(String userCode) {
        try {
            String tmp = config.getProperty("highmark.mock.usercodes", "");
            String[] tmps = tmp.split(",");
            for (String s : tmps) {
                String[] item = s.split("\\|");
                if (item[0].equals(userCode) && DateUtil.diffDate(new Date(), DateUtil.getDate(item[1], "yyyyMMdd")) <= 0) {
                    if ("PASS".equals(item[2])) {
                        return 1;
                    }
                    if ("REJECT".equals(item[2])) {
                        return 2;
                    }
                }
            }
        } catch (Exception e) {
            return 0;
        }
        return 0;
    }

    /**
     * 催收app强更信息
     *
     * @return
     */
    public JSONObject getCollectionAppUpdateInfo() {
        String tmp = config.getProperty("collection.app.update.info", "{}");
        JSONObject o1 = JSON.parseObject(tmp);
        return o1;
    }

    /**
     * 答题作无报告处理
     *
     * @return
     */
    public boolean getHighmarkManualAsNoReport() {
        return config.getBooleanProperty("highmark.manual.as.noreport", false);
    }

    public List<String> getNeedSendEmailAppCode() {
        String appCodes = config.getProperty("need.send.email.appcode", "5,38");
        String[] sArr = appCodes.split(",");
        return Arrays.asList(sArr);
    }

    /**
     * 风控地址
     *
     * @return
     */
    public Integer getAuditDistributeUserType() {
        return config.getIntProperty("audit.distribute.usertype", null);
    }

    /**
     * 数据归档任务
     *
     * @return
     */
    public boolean getDataArchiveTaskSwitch() {
        return config.getBooleanProperty("data.archive.task.switch", false);
    }

    /**
     * 催收导出功能开关
     *
     * @return
     */
    public boolean getCollectionExportAllow() {
        return config.getBooleanProperty("collection.export.allow", false);
    }

    public boolean getCommonTypeQuerySwitch() {
        return config.getBooleanProperty("commontype.query.switch", false);
    }

    /**
     * 测试服是否允许智能外呼
     *
     * @return
     */
    public boolean getTestServiceOutboundAllow() {
        return config.getBooleanProperty("testservice.outbound.allow", false);
    }

    /**
     * 测试服是否允许智能外呼
     *
     * @return
     */
    public boolean getOutboundSwitch() {
        return config.getBooleanProperty("outbound.switch", false);
    }

    /**
     * 测试服是否允许智能外呼
     *
     * @return
     */
    public JSONObject getOutboundParams() {
        String tmp = config.getProperty("outbount.params", "{}");
        return JSON.parseObject(tmp);
    }

    /**
     * 外呼功能job开关
     *
     * @return
     */
    public Boolean getOutboundTaskSwitch() {
        return config.getBooleanProperty("outbound.task.switch", false);
    }

    /**
     * 还款通知地址
     *
     * @return
     */
    public String getRepaymentNotifyUrl() {
        return config.getProperty("artificial.repayment.notify.url", "");
    }

    /**
     * 展期还款通知地址
     *
     * @return
     */
    public String getExtensionNotifyUrl() {
        return config.getProperty("artificial.extension.notify.url", "");
    }

    /**
     * mock还款链接
     *
     * @return
     */
    public boolean getRepayLinksMock() {
        return config.getBooleanProperty("repay.links.mock", false);
    }

    /**
     * 还款链接操作白名单
     *
     * @return
     */
    public List<String> getRepayLinksOperateAdminId() {
        String tmp = config.getProperty("repay.links.operate.admins", "");
        if (StringUtils.isEmpty(tmp)) {
            return new ArrayList<>();
        }
        String[] sArr = tmp.split(",");
        return Arrays.asList(sArr);
    }

    /**
     * 催记是否需要记录通话信息（开启新接口后，催记就不用记录通话信息了，避免重复）
     *
     * @return
     */
    public boolean getClCommentAddCallRecords() {
        return config.getBooleanProperty("collection.comment.add.callrecords", false);
    }

    /**
     * 抵扣发短信白名单，为空则不控制
     *
     * @return
     */
    public String getDeductSendMsgUserCode() {
        return config.getProperty("deduct.send.msg.usercodes", "");
    }


    public String getUserFeedBackEmail(String email) {
        LOGGER.info("== getUserFeedBackEmail a==,email:{}", email);
        String property = config.getProperty("user.default.feedback.email.address", "sm1989@126.com");
        LOGGER.info("== getUserFeedBackEmail b==,email:{}", property);
        if (StringUtils.isEmpty(property)) {
            return email;
        }

        return property;
    }

    /**
     * 展期服务费
     *
     * @return
     */
    public String getExtensionServiceFee() {
        return config.getProperty("extension.servicefee", "200");
    }

    /**
     * 展期天数
     *
     * @return
     */
    public Integer getExtensionDays() {
        return config.getIntProperty("extension.days", 30);
    }

    /**
     * 催收修复状态任务开关
     *
     * @return
     */
    public boolean getCollectionFixJobSwitch() {
        return config.getBooleanProperty("collection.status.fix.switch", false);
    }

    /**
     * 音频转换开关
     *
     * @return
     */
    public boolean getFfmpegConvertToMp3Switch() {
        return config.getBooleanProperty("ffmpeg.convert.switch", false);
    }

    /**
     * 音频转换开关
     *
     * @return
     */
    public boolean getCMAppRecordingSwitch() {
        return config.getBooleanProperty("cmapp.recording.switch", false);
    }


    public boolean closedPrePaymentOrderOpen() {
        return config.getBooleanProperty("closed.prepayment.orders.open", false);
    }

    /**
     * 音频转换机器ip地址
     *
     * @return
     */
    public String getFfmpegConvertIp() {
        return config.getProperty("ffmpeg.convert.ip", "xxx");
    }


    /**
     * 是否允许抵扣
     *
     * @return
     */
    public boolean getCollectionDeductAllow() {
        return config.getBooleanProperty("collection.deduct.allow", false);
    }


    /**
     * 后台通讯录页面是否展示
     *
     * @return
     */
    public boolean getAddressBookSwitch() {
        return config.getBooleanProperty("address.book.switch", false);
    }

    /**
     * 接口展示控制
     *
     * @return
     */
    public String getAddressBookShowType() {
        return config.getProperty("address.book.show", "third,emergency,addressbook,audit_contacts");
    }

    /**
     * 接口展示控制
     *
     * @return
     */
    public String getCollectionNoShuffleDate() {
        return config.getProperty("collection.no.shuffle.date", "");
    }

    public static void main(String[] args) {
        String categoryMap = "[\n" +
                "    {\n" +
                "        \"productCategory\":\"sdzzall\",\n" +
                "        \"appName\":\"cashmama\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"cashbullAll\",\n" +
                "        \"appName\":\"cashmama\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"beautyCashAll\",\n" +
                "        \"appName\":\"cashmama\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"cashboxall\",\n" +
                "        \"appName\":\"cashmama\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"dhanaDhanV6All\",\n" +
                "        \"appName\":\"dhanadhan\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"productCategory\":\"dhanaDhanV7All\",\n" +
                "        \"appName\":\"dhanadhan\"\n" +
                "    },\n" +
                "        \"productCategory\":\"loanZoneAll\",\n" +
                "        \"appName\":\"loanZone\"\n" +
                "    }\n" +
                "]";

        JSONArray jsonArray = JSONArray.parseArray(categoryMap);
        for (Object o : jsonArray) {
            JSONObject jsonObject = (JSONObject) o;
            String productCategory = jsonObject.getString("productCategory");
            String appName = jsonObject.getString("appName");
            if ("loanZoneAll".equals(productCategory)) {
                System.err.println(appName);
            }
        }

    }

}
